<!--
 ______________
< EDLad.com >
 --------------
        \   ^__^
         \  (**)\__$__$__
            (__)\       )\/\
             U  ||------|
                ||     ||
-->
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Ubuntu 下安装和配置 Apache2 + Nginx + PHP5 + Mysql5 | ED少年 - 王文宏的博客</title>
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
  <meta name="keywords" content="ED少年,ED,CSS,CSS3,SASS,Javascript,jQuery,Linux,Ubuntu,NodeJS,MongoDB,Mac">
  <meta name="description" content="这是 Eded 的个人博客，他的精神在这里驻扎生根，未成年人请在监护人陪同下游览。ED 是一名经验丰富的 CSSer，写博客的目的主要是记录工作中遇到的问题。">
  <link rel="stylesheet" href="/css/main.css">
</head>

<body >
  <svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-nature" viewBox="0 0 32 32">
<title>nature</title>
<path class="path1" d="M18.667 9.333c0-1.467-1.2-2.667-2.667-2.667s-2.667 1.2-2.667 2.667 1.2 2.667 2.667 2.667 2.667-1.2 2.667-2.667zM14.667 9.333c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333-0.533 1.333-1.333 1.333-1.333-0.533-1.333-1.333z"></path>
<path class="path2" d="M17.333 22.267v-4c0.8-0.4 1.333-1.333 1.333-2.267v-0.267l0.133 0.133c1.067 1.067 2.667 1.067 3.733 0s1.067-2.667 0-3.733l-0.133-0.133h0.267c1.467 0 2.667-1.2 2.667-2.667s-1.2-2.667-2.667-2.667h-0.267l0.133-0.133c1.067-1.067 1.067-2.667 0-3.733s-2.667-1.067-3.733 0l-0.133 0.133v-0.267c0-1.467-1.2-2.667-2.667-2.667s-2.667 1.2-2.667 2.667v0.267l-0.133-0.133c-1.067-1.067-2.667-1.067-3.733 0s-1.067 2.667 0 3.733l0.133 0.133h-0.267c-1.467 0-2.667 1.2-2.667 2.667s1.2 2.667 2.667 2.667h0.267l-0.267 0.133c-1.067 1.067-1.067 2.667 0 3.733s2.667 1.067 3.733 0l0.133-0.133v0.267c0 0.933 0.533 1.867 1.333 2.267v4c-1.333-2.133-3.733-3.6-6.533-3.6h-1.333v5.333c0 4.4 3.6 8 8 8h2.667c4.4 0 8-3.6 8-8v-5.333h-1.333c-2.8 0-5.2 1.467-6.667 3.6zM13.333 13.867l-1.067 1.067c-0.533 0.533-1.333 0.533-1.867 0s-0.533-1.333 0-1.867l1.067-1.067c-0.267-0.4-0.533-0.8-0.667-1.333h-1.467c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h1.467c0.133-0.533 0.267-0.933 0.533-1.333l-0.933-1.067c-0.533-0.533-0.533-1.333 0-1.867s1.333-0.533 1.867 0l1.067 1.067c0.4-0.267 0.933-0.4 1.333-0.533v-1.6c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v1.467c0.533 0.133 0.933 0.267 1.333 0.533l1.067-1.067c0.533-0.533 1.333-0.533 1.867 0s0.533 1.333 0 1.867l-1.067 1.2c0.267 0.4 0.4 0.933 0.533 1.333h1.6c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333h-1.467c-0.133 0.533-0.267 0.933-0.533 1.333l1.067 1.067c0.533 0.533 0.533 1.333 0 1.867s-1.333 0.533-1.867 0l-1.2-1.067c-0.4 0.267-0.933 0.4-1.333 0.533v1.6c0 0.8-0.533 1.333-1.333 1.333s-1.333-0.533-1.333-1.333v-1.467c-0.533-0.133-0.933-0.4-1.333-0.667zM14.667 30.667c-3.733 0-6.667-2.933-6.667-6.667v-4c3.733 0 6.667 2.933 6.667 6.667v4zM24 24c0 3.733-2.933 6.667-6.667 6.667v-4c0-3.733 2.933-6.667 6.667-6.667v4z"></path>
</symbol>
<symbol id="icon-book" viewBox="0 0 32 32">
<title>book</title>
<path class="path1" d="M31.434 8.421h-0.029c-0.548 0.004-0.633-0.473-0.642-0.694v-3.457c0-0.369-0.299-0.668-0.667-0.668h-9.883c-2.48 0-3.404 0.919-3.634 1.208l-0.063 0.088-0 0.002-0.195 0.268c-0 0-0 0-0 0-0.262 0.361-0.491 0.207-0.601 0.089l-0.374-0.466-0.185-0.223c-0.311-0.327-1.121-0.964-2.728-0.964h-10.528c-0.369 0-0.668 0.299-0.668 0.668v3.413c0 0.598-0.325 0.717-0.523 0.738h-0.148c-0.162 0.010-0.539 0.104-0.539 0.797v16.265c0 0.399 0.324 0.722 0.723 0.722h9.609c3.066 0 4.402 1.156 4.802 1.599l0.229 0.283h0.001c0 0 0.613 0.694 1.259 0v0l0.134-0.157v0l0.002-0.002 0.171-0.2c0.005-0.006 0.046-0.052 0.105-0.113 0.512-0.497 1.79-1.412 4.29-1.412h9.902c0.399 0 0.723-0.323 0.723-0.722v-16.422c0-0.588-0.425-0.637-0.54-0.64zM29.276 22.931c0 0.32-0.267 0.579-0.601 0.579h-8.148c-2.899 0-3.952 1.31-3.952 1.31l-0.134 0.179-0.063 0.087c-0 0-0 0-0 0-0.276 0.375-0.683 0.003-0.685 0.001l-0.188-0.235c-0.139-0.167-1.204-1.343-3.781-1.343h-8.4c-0.332 0-0.599-0.259-0.599-0.579v-17.331c0-0.32 0.268-0.579 0.599-0.579h6.521c4.851 0 5.31 2.756 5.342 3.556v12.053c0 0.876 0.418 1.041 0.653 1.064h0.35c0.24-0.024 0.622-0.166 0.622-0.85v-12.423h-0.004c0.036-1.002 0.427-3.401 3.345-3.401h8.521c0.333 0 0.601 0.259 0.601 0.579v17.332z"></path>
</symbol>
<symbol id="icon-bug" viewBox="0 0 32 32">
<title>bug</title>
<path class="path1" d="M16-0.092c-2.867 0-5.24 2.115-5.641 4.874h11.281c-0.401-2.759-2.773-4.874-5.641-4.874z"></path>
<path class="path2" d="M11.77 6.253h-3.669l-2.261-3.785c-0.241-0.403-0.668-0.629-1.106-0.629-0.225 0-0.452 0.059-0.659 0.183-0.61 0.365-0.809 1.157-0.445 1.768l3.010 5.038h2.001c-2.093 1.789-3.562 4.314-3.943 7.172h-2.859c-0.508 0-0.92 0.412-0.92 0.92v0.552c0 0.508 0.412 0.92 0.92 0.92h2.8c0.209 2.531 1.27 4.826 2.874 6.621h-0.872l-3.010 5.036c-0.365 0.61-0.166 1.401 0.444 1.766 0.207 0.124 0.435 0.182 0.659 0.182 0.438 0 0.865-0.224 1.106-0.627l2.261-3.783h2.715c1.31 0.685 2.754 1.123 4.265 1.247v-22.58h-3.31z"></path>
<path class="path3" d="M30.161 16h-2.855c-0.367-2.859-1.79-5.384-3.869-7.172h2.003l3.013-4.883c0.374-0.605 0.186-1.399-0.419-1.773s-1.398-0.184-1.772 0.421l-2.258 3.66h-7.084v22.58c1.559-0.124 3.027-0.562 4.344-1.247h2.74l2.258 3.658c0.373 0.605 1.166 0.793 1.772 0.419s0.793-1.167 0.419-1.772l-3.012-4.88h-0.885c1.583-1.794 2.607-4.090 2.809-6.621h2.798c0.508 0 0.92-0.412 0.92-0.92v-0.552c0-0.508-0.412-0.92-0.92-0.92z"></path>
</symbol>
<symbol id="icon-burger" viewBox="0 0 32 32">
<title>burger</title>
<path class="path1" d="M22.667 5.333h-13.333c-5.2 0-9.333 4.133-9.333 9.333v13.333c0 2.267 1.733 4 4 4h24c2.267 0 4-1.733 4-4v-13.333c0-5.2-4.133-9.333-9.333-9.333zM2.667 17.333h11.733l2.667 2.667h-14.4v-2.667zM16.4 17.333h9.6l-4.8 4.8-4.8-4.8zM29.333 28c0 0.8-0.533 1.333-1.333 1.333h-24c-0.8 0-1.333-0.533-1.333-1.333v-1.333h26.667v1.333zM29.333 25.333h-26.667v-2.667h17.067l1.333 1.333 1.333-1.333h6.933v2.667zM29.333 20h-4.133l2.667-2.667h1.467v2.667zM29.333 16h-26.667v-1.333c0-3.733 2.933-6.667 6.667-6.667h13.333c3.733 0 6.667 2.933 6.667 6.667v1.333z"></path>
<path class="path2" d="M22.667 12c0 0.736-0.597 1.333-1.333 1.333s-1.333-0.597-1.333-1.333c0-0.736 0.597-1.333 1.333-1.333s1.333 0.597 1.333 1.333z"></path>
<path class="path3" d="M16 10.667c0 0.736-0.597 1.333-1.333 1.333s-1.333-0.597-1.333-1.333c0-0.736 0.597-1.333 1.333-1.333s1.333 0.597 1.333 1.333z"></path>
<path class="path4" d="M10.667 12c0 0.736-0.597 1.333-1.333 1.333s-1.333-0.597-1.333-1.333c0-0.736 0.597-1.333 1.333-1.333s1.333 0.597 1.333 1.333z"></path>
</symbol>
<symbol id="icon-costumes" viewBox="0 0 32 32">
<title>costumes</title>
<path class="path1" d="M32.014 9.44c-0.085-5.66-4.878-5.369-4.878-5.369-0.368 0.006-4.321 0.165-4.344 3.888-0.002 0.018 0 0.039-0.002 0.057v0.011c-0.003 0.181 0.002 0.413 0.012 0.669l-0.003 0.002v1.52c-0.002 0.011-0.006 0.019-0.009 0.030-0.002 0.209-0.005 0.406-0.005 0.59h-0c0 0 0.009 0.98-0.523 1.407-0.067 0.044-0.133 0.091-0.208 0.123-0.027 0.011-0.058 0.018-0.087 0.026-0.113 0.036-0.23 0.063-0.354 0.063-0.656 0-1.187-0.531-1.187-1.186 0-0.019 0.006-0.034 0.006-0.052 0-0.007-0.002-0.010-0.002-0.018v-1.817h-0.002v-0.001c0-0.392-0.32-0.71-0.71-0.71-0.393 0-0.711 0.319-0.711 0.71v2.060c0 1.746 1.59 2.316 1.909 2.412 0.267 0.047 0.55 0.079 0.86 0.079 1.505-0.037 2.163-1.235 2.427-1.976 0.003-0.006 0.006-0.013 0.009-0.021 0.007-0.021 0.015-0.056 0.024-0.082 0.018-0.053 0.033-0.104 0.047-0.149 0.006-0.024 0.013-0.045 0.020-0.071 0.041-0.155 0.056-0.252 0.056-0.252l-0.002-0.001c0.063-0.318 0.114-0.725 0.119-1.26v-1.224c0-0.145 0.011-0.273 0.019-0.402-0.005-0.062-0.019-0.119-0.019-0.181 0-1.502 1.219-2.72 2.72-2.72 1.482 0 2.68 1.184 2.715 2.656h0.006v0.052c0 0.004 0.002 0.008 0.002 0.012s-0.002 0.008-0.002 0.012v1.973c0.002 0.030 0.009 0.058 0.009 0.088h0.006v0.11c0 0.024 0.005 0.049 0.005 0.075 0 0.013-0.005 0.025-0.005 0.039v4.626c0 1.102-0.78 1.090-1.1 1.041-0.849-0.177-1.574-0.448-1.574-0.448l0.012 0.021c-0.892-0.302-1.862-0.482-2.886-0.482-1.47 0-2.832 0.351-3.996 0.943l-0.005-0.009c0 0-0.032 0.020-0.082 0.052-0.235 0.125-0.46 0.259-0.677 0.401-0.898 0.5-2.426 1.23-3.688 1.236-1.864-0.030-3.816-1.41-3.816-1.41v0.011c-1.263-0.764-2.816-1.224-4.505-1.224-0.872 0-1.704 0.132-2.484 0.354v-0.013c0 0-1.327 0.418-2.582 0.615-0.679 0.127-0.77-0.403-0.779-0.633v-4.471c0-0.011-0.004-0.023-0.004-0.034 0-0.021 0.003-0.043 0.004-0.064v-0.094h0.004c0.002-0.025 0.006-0.050 0.008-0.074v-1.693c0-0.005-0-0.007-0-0.011 0-0.003 0-0.008 0-0.011v-0.044h0.004c0.030-1.264 1.058-2.279 2.329-2.279 1.29 0 2.333 1.044 2.333 2.333 0 0.053-0.011 0.102-0.015 0.155 0.007 0.111 0.015 0.222 0.015 0.345v1.052c0.003 0.459 0.048 0.809 0.103 1.081l-0.003 0.001c0 0 0.014 0.084 0.050 0.217 0.006 0.022 0.011 0.040 0.018 0.061 0.011 0.040 0.026 0.082 0.040 0.129 0.007 0.021 0.015 0.050 0.021 0.069 0.003 0.005 0.005 0.013 0.008 0.019 0.227 0.636 0.792 1.662 2.082 1.694 0.265 0 0.508-0.027 0.737-0.068 0.274-0.084 1.639-0.572 1.639-2.070v-1.768h-0.030c0.002-0.020 0.011-0.037 0.011-0.058 0-0.332-0.27-0.601-0.601-0.601s-0.601 0.27-0.601 0.601c0 0.021 0.009 0.039 0.011 0.058h-0.011v1.559c0 0.006-0.002 0.009-0.002 0.014 0.001 0.015 0.005 0.029 0.005 0.044 0 0.562-0.456 1.018-1.018 1.018-0.107 0-0.208-0.024-0.304-0.055-0.024-0.008-0.050-0.013-0.073-0.023-0.065-0.026-0.121-0.066-0.179-0.105-0.457-0.365-0.449-1.206-0.449-1.206v0c-0.002-0.158-0.003-0.328-0.005-0.507-0.002-0.009-0.006-0.017-0.008-0.025v-1.303l-0.002-0.002c0.008-0.22 0.013-0.418 0.010-0.574v-0.010c0-0.016 0-0.034-0-0.049-0.019-3.194-3.41-3.33-3.727-3.336 0 0-4.113-0.25-4.186 4.605h-0.006v10.927c0 1.249 0.245 2.115 0.459 2.64 1.063 2.418 3.873 4.148 7.178 4.148 3.138 0 5.825-1.558 6.999-3.784l0.002 0.002c0 0 0.009-0.017 0.016-0.033 0.009-0.017 0.018-0.033 0.026-0.050 0.126-0.244 0.557-0.982 1.214-0.982h0.127c0.717-0.002 1.153 0.633 1.325 0.943 0.020 0.044 0.042 0.084 0.064 0.125 0.012 0.026 0.020 0.044 0.020 0.044l0.003-0.003c1.186 2.201 3.857 3.739 6.974 3.739 2.975 0 5.549-1.399 6.809-3.44 0.203-0.343 0.827-1.5 0.827-2.839v-12.213h-0.007zM3.893 20.543c3.903-4.526 8.595 0.228 8.595 0.228-3.155 4.172-7.348 1.931-8.595-0.228zM19.512 20.771c0 0 4.692-4.754 8.595-0.228-1.247 2.159-5.44 4.401-8.596 0.228z"></path>
</symbol>
<symbol id="icon-doctors" viewBox="0 0 32 32">
<title>doctors</title>
<path class="path1" d="M27.619 1.778c-3.345-2.733-8.274-2.237-11.009 1.109l-13.339 16.326c-2.734 3.345-2.239 8.276 1.108 11.009s8.276 2.239 11.011-1.108l13.339-16.327c2.734-3.346 2.238-8.275-1.109-11.009zM15.948 24.547l-1.46 1.787c-1.973 2.416-5.585 2.727-8.069 0.698-0.154-0.126-0.297-0.259-0.435-0.397-0.266-0.328 0.17-0.402 0.17-0.402l0.005-0.010c1.541 0.206 5.622 0.434 9.412-2.104l0.006 0.015c0 0 0.207-0.090 0.307 0 0.1 0.091 0.17 0.284 0.065 0.413zM27.121 12.066l-2.286 2.799c-0.043 0.056-0.080 0.115-0.125 0.171l-2.852 3.492-9.377-7.397 5.403-6.611c2.084-2.551 5.843-2.929 8.393-0.845 2.552 2.084 2.929 5.842 0.845 8.393z"></path>
</symbol>
<symbol id="icon-hospital" viewBox="0 0 32 32">
<title>hospital</title>
<path class="path1" d="M30.667 10.667h-5.333v-9.333c0-0.8-0.933-1.333-1.6-1.333h-16c-0.8 0-1.067 0.533-1.067 1.333v9.333h-5.333c-0.8 0-1.333 0.533-1.333 1.333v20h32v-20c0-0.8-0.533-1.333-1.333-1.333zM18.667 29.333h-5.333v-5.333h5.333v5.333zM29.333 29.333h-9.333v-6.667h-8v6.667h-9.333v-16h6.667v-10.667h13.333v10.667h6.667v16z"></path>
<path class="path2" d="M17.333 17.333h2.667v2.667h-2.667v-2.667z"></path>
<path class="path3" d="M12 17.333h2.667v2.667h-2.667v-2.667z"></path>
<path class="path4" d="M6.667 17.333h2.667v2.667h-2.667v-2.667z"></path>
<path class="path5" d="M22.667 17.333h2.667v2.667h-2.667v-2.667z"></path>
<path class="path6" d="M22.667 22.667h2.667v2.667h-2.667v-2.667z"></path>
<path class="path7" d="M6.667 22.667h2.667v2.667h-2.667v-2.667z"></path>
<path class="path8" d="M17.333 5.333h-2.667v2.667h-2.667v2.667h2.667v2.667h2.667v-2.667h2.667v-2.667h-2.667z"></path>
</symbol>
<symbol id="icon-office" viewBox="0 0 32 32">
<title>office</title>
<path class="path1" d="M30.533 1.333h-6.533c0-0.8-0.533-1.333-1.333-1.333s-1.333 0.533-1.333 1.333h-10.667c0-0.8-0.533-1.333-1.333-1.333s-1.333 0.533-1.333 1.333h-6.533c-0.8 0-1.467 0.667-1.467 1.467v27.733c0 0.8 0.667 1.467 1.467 1.467h29.067c0.8 0 1.467-0.667 1.467-1.467v-27.733c0-0.8-0.667-1.467-1.467-1.467zM29.333 29.333h-26.667v-18.667h26.667v18.667zM29.333 9.333h-26.667v-5.333h5.333v1.333c0 0.8 0.533 1.333 1.333 1.333s1.333-0.533 1.333-1.333v-1.333h10.667v1.333c0 0.8 0.533 1.333 1.333 1.333s1.333-0.533 1.333-1.333v-1.333h5.333v5.333z"></path>
<path class="path2" d="M10.667 13.333h-5.333v5.333h5.333v-5.333zM9.333 17.333h-2.667v-2.667h2.667v2.667z"></path>
<path class="path3" d="M18.667 13.333h-5.333v5.333h5.333v-5.333zM17.333 17.333h-2.667v-2.667h2.667v2.667z"></path>
<path class="path4" d="M26.667 13.333h-5.333v5.333h5.333v-5.333zM25.333 17.333h-2.667v-2.667h2.667v2.667z"></path>
<path class="path5" d="M10.667 21.333h-5.333v5.333h5.333v-5.333zM9.333 25.333h-2.667v-2.667h2.667v2.667z"></path>
<path class="path6" d="M18.667 21.333h-5.333v5.333h5.333v-5.333zM17.333 25.333h-2.667v-2.667h2.667v2.667z"></path>
<path class="path7" d="M26.667 21.333h-5.333v5.333h5.333v-5.333zM25.333 25.333h-2.667v-2.667h2.667v2.667z"></path>
</symbol>
<symbol id="icon-shoes" viewBox="0 0 32 32">
<title>shoes</title>
<path class="path1" d="M29.268 2.693c-0.019-0.015-0.965-0.704-1.677 0.205-2.277 2.922-9.84 12.538-13.504 15.942-3.2 2.974-6.011 1.279-7.274 0.182v0.003c0 0-0.647-0.672-2.127-0.21-0.003 0.001-0.003 0.001-0.007 0.001-0.601 0.198-1.417 0.45-2.518 0.77-1.561 0.451-2.046 1.626-2.098 2.75 0.029 0.372 0.214 2.064 1.159 3.191 1.722 1.763 5.088 3.589 8.656 3.971 4.122 0.438 5.13-1.273 5.13-1.273s2.514-3.401 4.87-6.859c0.002-0.003 0.005-0.005 0.007-0.009 2.034-2.928 4.439-4.399 4.491-4.431 0.139-0.061 0.273-0.119 0.401-0.166 0.261-0.078 1.669-0.409 1.786 1.508l0.599 10.236 0.003 0.132c0 0 0 0.002 0 0.004l0.006 0.186c0.024 0.273 0.148 0.745 0.725 0.746 0.54-0.011 0.611-0.613 0.616-0.858v-0.105c0.219-2.672 1.177-12.605 2.064-14.415 3.011-6.893 0.314-10.225-1.308-11.499z"></path>
</symbol>
<symbol id="icon-skull" viewBox="0 0 32 32">
<title>skull</title>
<path class="path1" d="M9.345 27.63c0 1.285 1.041 2.326 2.326 2.326h8.722c1.285 0 2.326-1.041 2.326-2.326v-0.68c0-0.546 0.378-1.006 0.889-1.128 2.791-0.43 4.925-2.844 4.925-5.751 0-1.308-0.431-2.518-1.163-3.489v-3.977c0-5.832-5.077-10.56-11.339-10.56s-11.339 4.727-11.339 10.56v3.977c-0.732 0.971-1.163 2.181-1.163 3.489 0 2.907 2.134 5.321 4.925 5.751 0.512 0.122 0.89 0.581 0.89 1.128v0.68zM8.182 16c0-1.605 1.303-2.907 2.907-2.907s2.907 1.303 2.907 2.907c0 1.605-1.303 2.907-2.907 2.907s-2.907-1.303-2.907-2.907zM18.067 16c0-1.605 1.303-2.907 2.908-2.907s2.907 1.303 2.907 2.907c0 1.605-1.303 2.907-2.907 2.907s-2.908-1.303-2.908-2.907zM13.165 22.21l2.047-2.047c0.454-0.454 1.186-0.454 1.64 0l2.047 2.047c0.442 0.442 0.442 1.157 0 1.599s-1.157 0.442-1.599 0l-1.267-1.267-1.268 1.267c-0.441 0.442-1.157 0.442-1.599 0s-0.441-1.157-0-1.599z"></path>
</symbol>
<symbol id="icon-rocket" viewBox="0 0 32 32">
<title>rocket</title>
<path class="path1" d="M16 2.908c0 0-5.037 3.908-5.037 13.508 0 6.157 1.862 10.006 4.287 10.665v-6.197c0-0.414 0.335-0.75 0.75-0.75s0.75 0.336 0.75 0.75v6.197c2.425-0.657 4.287-4.508 4.287-10.665 0-9.711-5.037-13.508-5.037-13.508zM15.941 10.316c-0.864 0-1.709-0.078-2.457-0.219 0.732-2.361 1.765-3.95 2.526-4.88 0.758 0.918 1.786 2.495 2.514 4.857-0.777 0.157-1.667 0.242-2.582 0.242z"></path>
<path class="path2" d="M9.612 20.66c-1.504 0-2.722 1.041-2.722 2.324v6.109l4.931-3.648c-0.732-1.248-1.278-2.869-1.601-4.785h-0.608z"></path>
<path class="path3" d="M22.388 20.66h-0.608c-0.323 1.916-0.869 3.537-1.601 4.785l4.931 3.648v-6.109c-0-1.284-1.219-2.324-2.723-2.324z"></path>
</symbol>
</defs>
</svg>


  <div class="container">
    
<div class="breadcrumbs">
  <svg class="icon"><use xlink:href="#icon-burger"></use></svg>
  <ul>
    <li><a href="/">首页</a></li>
    
    
    <li>Ubuntu 下安装和配置 Apache2 + Nginx + PHP5 + Mysql5</li>
    
  </ul>
</div>
<!-- /.breadcrumbs -->


    <article class="article">
  
  <header>
    
  
    <h1 class="title" itemprop="name">
      Ubuntu 下安装和配置 Apache2 + Nginx + PHP5 + Mysql5
    </h1>
  


  </header>

  
  <div class="meta">
    
      <a class="date" href="/2016/04/01/apache-nginx-php-mysql-for-ubuntu/">
  <svg class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-office"></use></svg>
  <time datetime="2016-03-31T16:00:00.000Z" itemprop="datePublished">2016-04-01</time>
</a>

    
    
  <div class="category">
    <a class="category-link" href="/categories/code/">编码</a><a class="category-link" href="/categories/code/linux/">linux</a>
  </div>


    
  <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/ubuntu/">ubuntu</a></li></ul>


  </div>

  


  <div class="body">
  
    <p>由于需要配置 PHP 环境 ，所以折腾一下。一开始用 Apache，成功以后换 Nginx，全部独立安装。</p>
<a id="more"></a>
<h3 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h3><p>介绍通过 apt-get 来安装，先确保最新源</p>
<pre><code class="bash">sudo apt-get update
</code></pre>
<p>通过 <code>apt-get</code> 安装都会注册服务，之后可以很方便的使用 <code>service</code> 命令管理</p>
<h3 id="安装-Apache"><a href="#安装-Apache" class="headerlink" title="安装 Apache"></a>安装 Apache</h3><p>安装 Apache2</p>
<pre><code class="bash">sudo apt-get install apache2
</code></pre>
<p>这一步基本上没什么问题，安装完 Apache2 配置文件在这个位置：</p>
<pre><code class="bash">/etc/apache2/apache2.conf
</code></pre>
<p>网站目录默认是 <code>/var/www/html</code></p>
<p>通常需要设置权限，我们修改目录读写权限为775或者777:</p>
<pre><code class="bash">sudo chmod 777 /var/www
</code></pre>
<p>如果修改配置文件，需要重启才能生效。重启有两种方式（我们可以用第一种）：</p>
<pre><code class="bash">sudo service apache2 restart  #对注册为服务的程序可以全局使用 service
</code></pre>
<p>或：</p>
<pre><code class="bash">sudo /etc/init.d/apache2 restart  #未注册 service 需要制定到程序目录
</code></pre>
<h3 id="安装-Nginx"><a href="#安装-Nginx" class="headerlink" title="安装 Nginx"></a>安装 Nginx</h3><p>安装 Nginx</p>
<pre><code class="bash">sudo apt-get install nginx
</code></pre>
<p>值得注意的是，Nginx 和 Apache 会抢夺80端口，最好先停止其中一个再装。</p>
<h3 id="安装-PHP5"><a href="#安装-PHP5" class="headerlink" title="安装 PHP5"></a>安装 PHP5</h3><p>安装PHP5的同时一起安装常用模块</p>
<pre><code class="bash">sudo apt-get install libapache2-mod-php5 php5 php5-gd php5-mysql php5-fpm php5-mcrypt php5-curl libcurl3 libcurl3-dev
</code></pre>
<p>这步通常也没什么问题。<br>安装好以后如果是 Apache，则 php.ini 在 <code>/etc/php5/apache2/php.ini</code>;<br>如果是 Nginx，则 php.ini 在 <code>/etc/php5/fpm/php.ini</code>;</p>
<p>另外装PHP的时候，也自动装了解析器，用来解析PHP语法，两个主要的文件分别在这两个目录：</p>
<pre><code class="bash">/var/run/php5-fpm.sock
/var/run/php5-fpm.pid
</code></pre>
<p>在程序工作中，可能会因为权限问题PHP无法创建目录，这是因为在这里有个用户组配置</p>
<pre><code class="bash">/etc/php5/fpm/pool.d/www.conf
</code></pre>
<p>里面有两个默认设置是</p>
<pre><code class="bash">user = www-data
group = www-data
</code></pre>
<p>需要给目录设置用户组以及用户为 <code>www-data:www-data</code> 并重启FPM</p>
<pre><code class="bash">user = www-data:www-data
group = www-data:www-data
</code></pre>
<h3 id="安装-MySQL"><a href="#安装-MySQL" class="headerlink" title="安装 MySQL"></a>安装 MySQL</h3><p>安装 mysql5</p>
<pre><code class="bash">sudo apt-get install mysql-server mysql-client
</code></pre>
<p>安装过程中需要设置 root 密码，我设置的是 root。这步要记住自己设置的密码！</p>
<h3 id="安装-phpMyAdmin-工具"><a href="#安装-phpMyAdmin-工具" class="headerlink" title="安装 phpMyAdmin 工具"></a>安装 phpMyAdmin 工具</h3><p>安装 phpMyAdmin</p>
<pre><code class="bash">sudo apt-get install phpmyadmin
</code></pre>
<p>安装好以后，如果是 Apache 默认情况需要做软链，这样更方便使用：</p>
<pre><code class="bash">ln -s /usr/share/phpmyadmin /var/www/html
</code></pre>
<p>phpMyAdmin 需要配置扩展目录 extension_dir，需要修改 <code>php.ini</code>。</p>
<p>假如配置 Apache 位置在这里：</p>
<pre><code class="bash">sudo vi /etc/php5/apache2/php.ini
</code></pre>
<p>假如配置 Nginx 位置在这里：</p>
<pre><code class="bash">sudo vi /etc/php5/fpm/php.ini
</code></pre>
<h4 id="需要做这几个改动"><a href="#需要做这几个改动" class="headerlink" title="需要做这几个改动"></a>需要做这几个改动</h4><ol>
<li>extension_dir 启用，并且值等于“PHP扩展目录”</li>
<li>extension=msql.so 的注释解除</li>
<li>extension=curl.so 解决 curl 问题 <strong>（Nginx）</strong></li>
</ol>
<h3 id="记录几个重要的目录位置"><a href="#记录几个重要的目录位置" class="headerlink" title="记录几个重要的目录位置"></a>记录几个重要的目录位置</h3><p>php.ini 目录：<br><code>/etc/php5/apache2/php.ini</code></p>
<p>PHP扩展目录（日期可能不同）：<br><code>/usr/lib/php5/20131226</code></p>
<p>nginx.conf 配置文件：<br><code>/etc/nginx/nginx.conf</code></p>
<p>Nginx 的 php.ini<br><code>/etc/php5/fpm/php.ini</code></p>
<p>Apache2 配置文件：<br><code>/etc/apache2/apache2.conf</code></p>
<p>phpmyadmin 所在目录：<br><code>/usr/share/phpmyadmin</code></p>
<p>phpmyadmin 配置文件：<br><code>/usr/share/phpmyadmin/libraries/config.default.php</code></p>
<h3 id="小技巧"><a href="#小技巧" class="headerlink" title="小技巧"></a>小技巧</h3><p>安装完成可以通过命令查看执行文件位置，这样不用担心忘记</p>
<pre><code class="bash">which Apache2
</code></pre>
<p>/usr/sbin/apache2</p>
<pre><code class="bash">which php
</code></pre>
<p>/usr/bin/php</p>
<pre><code class="bash">which mysql
</code></pre>
<p>/usr/bin/mysql</p>
<h4 id="重启部分："><a href="#重启部分：" class="headerlink" title="重启部分："></a>重启部分：</h4><pre><code class="bash">service php5-fpm restart
service nginx restart
</code></pre>
<h4 id="不重启-nginx-令配置生效（Nginx方便的地方）"><a href="#不重启-nginx-令配置生效（Nginx方便的地方）" class="headerlink" title="不重启 nginx , 令配置生效（Nginx方便的地方）"></a>不重启 nginx , 令配置生效（Nginx方便的地方）</h4><pre><code class="bash">nginx -s reload
</code></pre>
<hr>
<h4 id="使用-Nginx-phpmyadmin-时遇到提示-缺少crypt，通过下面方式复制来，并且重启FPM服务即可"><a href="#使用-Nginx-phpmyadmin-时遇到提示-缺少crypt，通过下面方式复制来，并且重启FPM服务即可" class="headerlink" title="使用 Nginx  + phpmyadmin 时遇到提示 缺少crypt，通过下面方式复制来，并且重启FPM服务即可"></a>使用 Nginx  + phpmyadmin 时遇到提示 缺少crypt，通过下面方式复制来，并且重启FPM服务即可</h4><p>使用 cp 命令复制文件：</p>
<pre><code class="bash">cp /etc/php5/mods-available/mcrypt.ini /etc/php5/fpm/conf.d/
</code></pre>
<h3 id="参考资料"><a href="#参考资料" class="headerlink" title="参考资料"></a>参考资料</h3><ul>
<li><a href="http://www.xtzj.com/read-htm-tid-620142.html" target="_blank" rel="external">buntu环境下使用apt-get配置apache+php+mysql</a></li>
<li><a href="http://www.cnblogs.com/top5/archive/2012/06/22/2558779.html" target="_blank" rel="external">利用phpmyadmin修改mysql的root密码</a></li>
</ul>

  
  </div>

  
    
<nav class="article-nav">
  
    <a href="/2016/04/01/sshserver-for-ubuntu/" title="Ubuntu 下安装和配置 SSH Server" class="newer">
      <em>Ubuntu 下安装和配置 SSH Server</em>
    </a>
  
  
    <a href="/2016/04/01/nodejs-for-ubuntu/" title="Ubuntu 下通过 brew 简单安装最新 nodejs 环境" class="older">
      <em>Ubuntu 下通过 brew 简单安装最新 nodejs 环境</em>
    </a>
  
</nav>


  

  
  <div class="donate-qrcode">
    <h3>如果您觉得内容对您的学习有所帮助，您可以请我喝咖啡~ （不喝无名的咖啡，请告诉我你是谁）</h3>
    <ul>
      <li><img src="/images/weixin-pay.jpg" alt="微信支付二维码" class="weixin-pay"></li>
      <li><img src="/images/ali-pay.jpg" alt="支付宝支付二维码" class="ali-pay"></li>
    </ul>
    <p>（手机微信下可以长按左图二维码，选择“识别二维码”输入金额）</p>
  </div>
  <!-- /.donate-qrcode -->
  

  

  

</article>

  </div>
  <!-- /.container -->

  <div class="sidebar">
  <header>
  <a href="/" class="mylogo">
    
      <img src="/images/edlad-web-logo-512.png" alt="ED少年" title="ED少年">
      <img src="/images/edlad-web-logo-min.png" alt="ED少年" title="ED少年">
    
  </a>
  
  <h2>记录从学习前端开发到放弃的整个康复过程</h2>
  
</header>

  <nav class="navigation" id="navigation">
    
      <a title="首页" href="/">
        <svg class="icon"><use xlink:href="#icon-hospital"></use></svg><em>首页</em>
      </a>
    
      <a title="编码" href="/categories/code/">
        <svg class="icon"><use xlink:href="#icon-bug"></use></svg><em>编码</em>
      </a>
    
      <a title="生活" href="/categories/life/">
        <svg class="icon"><use xlink:href="#icon-costumes"></use></svg><em>生活</em>
      </a>
    
      <a title="作者" href="/author/">
        <svg class="icon"><use xlink:href="#icon-skull"></use></svg><em>作者</em>
      </a>
    
      <a title="友链" href="/friend/">
        <svg class="icon"><use xlink:href="#icon-nature"></use></svg><em>友链</em>
      </a>
    
  </nav>
  <nav class="mobile-navigation" id="mobile-navigation">
    <button><span>Menu</span></button>
    <!--
    <select>
      
      <option value="/">首页</option>
      
      <option value="/categories/code/">编码</option>
      
      <option value="/categories/life/">生活</option>
      
      <option value="/author/">作者</option>
      
      <option value="/friend/">友链</option>
      
    </select>
    -->
  </nav>
  <footer>
  <p>
    <a href="/atom.xml" target="_blank">
      <svg class="icon"><use xlink:href="#icon-doctors"></use></svg><em>RSS订阅</em>
    </a>
    |
    <a href="/sitemap.xml" target="_blank">
      <svg class="icon"><use xlink:href="#icon-shoes"></use></svg><em>网站地图</em>
    </a>
  </p>
  <p>Proudly powered by <a href="http://hexo.io/" target="_blank">Hexo</a></p>
  <p>Designed by <a href="">Eded Wang</a></p>
  <p>Copyright&copy; 2017 <a href="">ED少年</a></p>
  
  <p>闽ICP备16010082号</p>
  
</footer>

</div>
<!-- /.navigation -->

  <div id="retop" class="retop">
  <svg class="icon"><use xlink:href="#icon-rocket"></use></svg>
</div>


  <div class="mobile-nav" id="mobile-nav">
    <ul>
      
      <li>
        <a href="/">
          <svg class="icon"><use xlink:href="#icon-hospital"></use></svg>
          <em>首页</em>
        </a>
      </li>
      
      <li>
        <a href="/categories/code/">
          <svg class="icon"><use xlink:href="#icon-bug"></use></svg>
          <em>编码</em>
        </a>
      </li>
      
      <li>
        <a href="/categories/life/">
          <svg class="icon"><use xlink:href="#icon-costumes"></use></svg>
          <em>生活</em>
        </a>
      </li>
      
      <li>
        <a href="/author/">
          <svg class="icon"><use xlink:href="#icon-skull"></use></svg>
          <em>作者</em>
        </a>
      </li>
      
      <li>
        <a href="/friend/">
          <svg class="icon"><use xlink:href="#icon-nature"></use></svg>
          <em>友链</em>
        </a>
      </li>
      
    </ul>
  </div>
  <!-- /.mobile-nav -->
  <div class="shade" id="shade"></div>
  <!-- /.shade -->

  

  
    <script>
    (function(){
        if( location.hostname == "localhost" ) { return; }

        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        bp.src = curProtocol === 'https'
          ? 'https://zz.bdstatic.com/linksubmit/push.js'
          : 'http://push.zhanzhang.baidu.com/push.js';
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
    </script>
  

  <script src="/js/instantclick.min.js" data-no-instant></script>
  <script src="/js/jquery.min.js"></script>
  <script src="/js/prism.js"></script>
  <script src="/js/main.js" data-no-instant></script>

  
    <script src="//s4.cnzz.com/z_stat.php?id=1259789287&web_id=1259789287" data-no-instant></script>
  
  

</body>
</html>
